home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 051-075 / scopedisk52 / ts / tsx.mod < prev   
Text File  |  1995-03-18  |  4KB  |  149 lines

  1. MODULE TimeSaverSuperTickler;
  2.  
  3. (** ------------------------------------------------------------------
  4.  
  5.            This is the MODULA-2 Program Source Code
  6.  
  7.            TimeSaver for the Commodore Amiga - ClockTickler Module 
  8.  
  9.            This Program is placed in the Public Domain By its Author
  10.  
  11.            Written June 2nd, 1987 by E.J. Lippert II, for C Ltd.
  12.  
  13.     ------------------------------------------------------------------ **)
  14.  
  15. (** ------------------------------------------------------------------
  16.  
  17.            NOTE:  This version is modified to update clock on one
  18.  
  19.                   minute boundaries.
  20.  
  21.     ------------------------------------------------------------------ **)
  22.  
  23.  
  24.  
  25. (*  ====================================================================
  26.      VERSION FOR COMMODORE AMIGA
  27.  
  28.      Original Author : E.J. Lippert II for C Ltd.
  29.  
  30.      Version         : 1.00 - 02-Jun-87 02:33
  31. =====================================================================  *)
  32.  
  33.  
  34. FROM SYSTEM IMPORT ADDRESS;
  35. FROM InOut IMPORT Read, Write, WriteString, WriteLn;
  36. FROM DOSCodeLoader IMPORT Execute;
  37.  
  38.  
  39. VAR
  40.  
  41.         ch [12578305] : CHAR;  (* this is the address of the keyboard Port *)
  42.         i : CARDINAL;
  43.         D, DD : ARRAY [0..80] OF CHAR;
  44.         DUMMY : BOOLEAN;
  45.  
  46. BEGIN
  47.  
  48. D[0] := CHR(0);
  49.  
  50. WriteLn;
  51.  
  52. REPEAT
  53.  
  54.         DD := D;
  55.         D[0] := CHR(0);
  56.         i:= 0;
  57.  
  58. (* ==============================================================
  59.  
  60.         First Send a Value of 64 to the keyboard port and hold
  61.         this value for approx 10 ms. 
  62.  
  63.         The Value 64 sets the Bit at the port that causes the
  64.         Keyboard Data Line to go HIGH.
  65.  
  66.         10 ms. is worst case time required for a properly
  67.         operating TimeSaver to sense the HIGH line condition.
  68.  
  69. ============================================================== *)
  70.  
  71.         ch := CHR(64);
  72.  
  73.         LOOP
  74.         IF i > 8191 THEN EXIT; END;
  75.         INC(i);
  76.         END;
  77.  
  78.         ch := CHR(0);
  79.  
  80. (* ==============================================================
  81.  
  82.         A properly operating TimeSaver will now respond by
  83.         sending either the normally formatted Amiga DATE
  84.         Command (ie: DATE DD-MON-YY HH:MM) if it is active.
  85.  
  86.         If however the TimeSaver has been turned off, or the 
  87.         TimeSaver's Screen Echo has been disabled, a properly 
  88.         operating TimeSaver will respond with the date only.
  89.         (ie: DD-MON-YY HH:MM)
  90.  
  91. ============================================================== *)
  92.  
  93.  
  94.  
  95.         Read(D[0]);    (* Read the first character sent by the TimeSaver *)
  96.  
  97.         IF D[0] = "D" THEN   (* If it is a "D" then assume TimeSaver is
  98.                                 active and collect the DATE Command info *)
  99.                 i := 1;
  100.                 REPEAT
  101.                         Read(D[i]);
  102.                         INC(i);
  103.                 UNTIL D[i-1] = CHR(10);
  104.                 D[i-1] := CHR(0);
  105.         
  106.         ELSE                 (* Otherwise assume TimeSaver is not active so
  107.                                 Collect the RAW DATE and format the command *)
  108.                 D[5] := D[0];
  109.                 D[0] := "D";
  110.                 D[1] := "A";
  111.                 D[2] := "T";
  112.                 D[3] := "E";
  113.                 D[4] := " ";
  114.                 i := 6;
  115.                 REPEAT
  116.                         Read(D[i]);
  117.                         INC(i);
  118.                 UNTIL D[i-1] = CHR(10);
  119.                 D[i-1] := CHR(0);
  120.  
  121.         END;
  122.  
  123.         IF (DD[0] = CHR(0)) THEN
  124.                 DD := D;
  125.         END;
  126.  
  127.         Write(CHR(155)); Write("A");
  128.                 
  129. UNTIL ( DD[i-2] # D[i-2] );
  130.  
  131.  
  132. DUMMY := (Execute(D, 0, 0));            (* Execute the DATE Command 
  133.                                            and print notices.       *)
  134. WriteLn;
  135.  
  136. D := "Correct Time Now Set  -  TimeSaver   by C Ltd.";
  137. D[35] := CHR(169);
  138. WriteString(D);
  139.  
  140. WriteLn;
  141.  
  142. D := "                         Tickler by E.J. Lippert";
  143. WriteString(D);
  144.  
  145. WriteLn;
  146.  
  147.  
  148. END TimeSaverSuperTickler.
  149.